import java.util.Scanner;

public class code3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();//输入字符串并转为字符数组
        StringBuilder st = new StringBuilder();//模拟栈

        for (int i = 0; i < s.length; i++) {
            char ch = s[i];
            //删除字符：st得不为空
            if (st.length()!=0 && ch==st.charAt(st.length()-1)) {
                st.deleteCharAt(st.length()-1);
            } else {
                st.append(ch);
            }
        }
        System.out.println(st.length()==0?0:st.toString());//注意：如果是空字符串则输出0
    }
}
